/**
 * Description: js for desktop content display 
 * @author GaoXJ
 * @version 1.0 2007-12-21
 */

/**
 * 仿igoogle风格的自定义桌面js
 * @author modify by GaoXJ 2008-05-12 
 */
 var ISFLODUPING = 0;	//是否在折叠过程中；
 var ISCLOSING = 0;		//是否在关闭过程中，在关闭过程中无法进行再关闭操作。0：未处于正关闭状态、1：正在关闭；
 var FOLDSPEED = 4; 	//折叠的延时速度值，数值越大折叠速度越快；
 var ISDRAGING = 0;		//是否是在拖拽过程中；
 var MAGINLENGTH = 7;	//普通的margin值；
 var CONTAINERNUM = 7;	//可拖拽容器的个数;
 var XMLDOCUMENT = "main.xml"	//XML文件的相对路径，（记录各容器的标题和内容）;
 var ttttt = 0;  //列数
 var maxlen = 15; //截取字符串数
 var BIGLEN = 80; //截取字符串长度，大号
 var MIDDLELEN = 38; //截取字符串长度，中号
 var SMALLLEN = 23; //截取字符串长度，小号
/**
 * Description: main function
 */
var loadDesktop = function(obj) {
	JfossAjaxInvoke.loadPersonalDesktop(obj.id,obj.uid,{callback:function(data) {callLoadPersonalDesktop(data, obj);}});
};

/**
 * Description: callback function
 */
var callLoadPersonalDesktop = function(data, obj) {
	if(data) {
		switch (data.displayType) {
		   case "1" : //类似日程安排模板
		   		loadData1(data, obj);
		   		break;
		   case "2" : //类似新闻动态模板
		   	   	loadData2(data, obj);
		   	   	break;
		   case "3" : //类似局任务书模板
		   	   	loadData3(data, obj);
		   	   	break;
		   case "4" : //个人登陆信息模板
		   	   	loadData4(data, obj);
		   	   	break;  
		   case "5" : //个人邮箱信息模板
		   	   	loadData5(data, obj);
		   	   	break;   
		   case "6" : //系统消息模板
		   	   	loadData6(data, obj);
		   	   	break; 
		   case "7" : //滚动图片模板
		   	   	loadData7(data, obj);
		   	   	break; 
		   case "8" : //上下班登记模板
		   		loadData8(data, obj);
		   		break; 	  
		   case "9" : //待办事务模板
		   		loadData9(data, obj);
		   		break;	
		   case "10" : //统计信息模板
		   		loadData10(data, obj);
		   		break;		
		   case "11" : //滚动文字模板
		   		loadData11(data, obj);
		   		break;	
		   case "12" : //iframe模板
		   		loadData12(data, obj);
		   		break;				
		   default : //类似日程安排模板
		       	loadData1(data, obj);
		}
	}
};

/**
 * Description: the first display type
 * 类似日程安排模板
 *
 */
var loadData1 = function(data, param) {
var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<ul>";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i in list) {
			var obj = list[i];
			if(obj) {
				strHtml += "<li>";
				var title = "";
				if(obj.name) {
					title = obj.name;
					//多加5个字符
					if(title.length > param.len + 5) {
						title = title.substring(0,param.len + 5) + "...";
					}
				}
				var strUrl = "";
				if(data.linkUrl) {
					strUrl = param.basePath + data.linkUrl + obj.id;
					strUrl = "<a href=\"javascript:void(0)\" onclick=\"openwindow('"+strUrl+"','','1000','600')\" >" + title + "</a>";
				} else {
					strUrl = title;
				}
				strHtml += strUrl + "</li>";
			}
		}
		strHtml += "</ul>";
	}else{
		strHtml = "<img src=\""+param.basePath+"/jfoss2/desktop/userconfig/images/None01.gif\" width=\"85\" height=\"85\">";
	}
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the second display type
 * 类似新闻动态模板
 *
 */
var loadData2 = function(data, param) {
var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i in list) {
			var obj = list[i];
			if(obj) {
				if(obj.name) {
					strHtml += "<tr height=\"15\">";
					strHtml += "<td width=\"10px\">";
					strHtml += "<img src=\"resources/images/icon5.gif\" width=\"9\" height=\"9\"></td>";
					var title = "";
					//将标题分隔
					var astr = obj.name.split("\|\|\|");
					if(astr && astr.length > 0) {
						var len = astr.length;
						for(var j=0; j<len; j++) {
							if(j==0) {
								title = astr[0];
								if(title.length > param.len) {
									title = title.substring(0,param.len) + "...";
								}
								var strUrl = "";
								if(data.linkUrl) {
									strUrl = param.basePath + data.linkUrl + obj.id;
									strUrl = "<a href=\"" + strUrl + "\" target=\"" + param.target + "\"><span>" + title + "</span></a>";
								} else {
									strUrl = "<span>" + title + "</span>";
								}
								strHtml += "<td align=\"left\"\ width=\"70%\">" + strUrl + "</td>";
							} else {
								strHtml += "<td align=\"left\"><span>" + astr[j] + "</span></td>";
							}
						}
						strHtml += "</tr>";
						strHtml += "<tr><td colspan=\"" + (len+1) + "\" align=\"center\">";
						strHtml += "<img src=\"resources/images/bgxuxian.jpg\" width=\"385\" height=\"1\"></td></tr>";
					}
				}
			}
		}
	}else{
		strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\"><img src=\"/cims-20100712/jfoss2/desktop/userconfig/images/None02.gif\" width=\"85\" height=\"85\"></td></tr>";
	}
	strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the third display type
 * 类似局任务书模板
 *
 */
var loadData3 = function(data, param) {
var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i=0;i<list.length;i++) {
			var obj = list[i];
			if(obj) {
				if(i%2 == 0) {
					strHtml += "<tr height=\"15\">";
				} else {
					strHtml += "<tr height=\"15\" bgcolor=\"#f5f5f5\">";
				}
				strHtml += "<td align=\"left\" width=\"2px\">·</td>";
				var title = "";
				if(obj.name) {
					title = obj.name;
					if(title.length > param.len) {
						title = title.substring(0,param.len) + "...";
					}
				}
				var strUrl = "";
				if(data.linkUrl) {
					strUrl = param.basePath + data.linkUrl + obj.id;
					strUrl = "<a href=\"" + strUrl + "\" target=\"" + param.target + "\"><span>" + title + "</span></a>";
				} else {
					strUrl = "<span>" + title + "</span>";
				}
				strHtml += "<td align=\"left\" width=\"98%\">" + strUrl + "</td>";
				strHtml += "</tr>";
			}
		}
	}else{
		strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\"><img src=\"/cims-20100712/jfoss2/desktop/userconfig/images/None02.gif\" width=\"85\" height=\"85\"></td></tr>";
	}
	strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
//	strHtml += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
//	strHtml += "<tr><td height=\"2\">&nbsp;</td></tr>";
//	strHtml += "<tr><td height=\"7\"><img src=\"images/dtree/line.jpg\" width=\"226\" height=\"2\">";
//	strHtml += "</td></tr></table>";
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the fourth display type
 * 个人登陆信息模板
 *
 */
var loadData4 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	strHtml += "<tr><td width=\"20%\" height=\"17\" align=\"right\">";
	strHtml += "</td><td width=\"80%\">";
	strHtml += "</td></tr>";
	strHtml += "<tr><td width=\"20%\" height=\"17\" align=\"right\">";
	strHtml += "<span>姓名：</span></td><td width=\"80%\"><span>";
	strHtml += param.uname + "</span></td></tr>";
	strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the fifth display type
 * 个人邮箱信息模板
 *
 */
var loadData5 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	var list = data.list;
	if(list && list.length > 0) {
		var strUrl = param.basePath + "/oa/mail.do?op=searchinfoinit";
		strHtml += "<tr><td>&nbsp;</td><td>";
		strHtml += "<a href=\"" + strUrl + "\" target=\"" + param.target + "\"><span>您的邮箱： 共有<span class=\"fontorange\">" 
				+ list[0].id + "</span>封邮件</span></a></td></tr>";
		strHtml += "<tr><td>&nbsp;</td><td>";
		strHtml += "<a href=\"" + strUrl + "\" target=\"" + param.target + "\"><span>其中： <span class=\"fontorange\">" 
				+ list[0].name + "</span>封未读</span></a></td></tr>";
	}else{
		strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\"><img src=\"/cims-20100712/jfoss2/desktop/userconfig/images/None02.gif\" width=\"85\" height=\"85\"></td></tr>";
	}
	strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the sixth display type
 * 系统消息模板
 *
 */
var loadData6 = function(data, param) {
	/*
	var strHtml = "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	var list = data.list;
	if(list && list.length >= 4) {
		strHtml += "<tr><td align=\"center\">·</td>";
		strHtml += "<td>告警消息 （<span class=\"fontorange\">" + list[0].name + "</span>条）</td></tr>";
		strHtml += "<tr><td align=\"center\">·</td>";
		strHtml += "<td>故障消息 （<span class=\"fontorange\">" + list[1].name + "</span>条）</td></tr>";
		strHtml += "<tr><td align=\"center\">·</td>";
		strHtml += "<td>业务开通 （<span class=\"fontorange\">" + list[2].name + "</span>条）</td></tr>";
		strHtml += "<tr><td align=\"center\">·</td>";
		strHtml += "<td>值班日志 （<span class=\"fontorange\">" + list[3].name + "</span>条）</td></tr>";
	}
	strHtml += "<tr><td height=\"2\" colspan=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
	d.innerHTML = strHtml;
	*/
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	JfossAjaxInvoke.loadSystemMsgStat(param.id,param.uid,{callback:function(data) {callLoadSystemMsgStat(data, param, param.basePath);}});
};

/**
 * Description: the callback function for load system message
 * 系统消息加载回调函数
 */
var callLoadSystemMsgStat = function(data, param, basePath) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<table  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"fonts\">";
	var list = data;
	if(list && list.length > 0) {
		for(var i=0;i<list.length;i++) {
			var obj = list[i];
			if(obj) {
				var strUrl = "";
				if(obj.linkUrl && obj.count != "0") {
					strUrl = basePath + obj.linkUrl;
					strUrl = "<a href=\"" + strUrl + "\" target=\"" + param.target + "\">" + "<span class=\"fontorange\">" + obj.count + "</span></a>";
				} else {
					strUrl = "<span class=\"fontorange\">" + obj.count + "</span>";
				}
				strHtml += "<tr><td>·&nbsp;";
				strHtml += "<span>" + obj.title + "" + " （</span>" + strUrl + "<span>条）</span></td></tr>";
			}
		}
	}
	strHtml += "<tr><td height=\"2\" align=\"center\">&nbsp;</td></tr>";
	strHtml += "</table>";
	strDiv.innerHTML = strHtml;
};

/**
 * Description: 打开窗口并居中
 */
function openWin(url,title,wid,hei) {
	var params = "toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no,width="+ wid + ",height=" + hei;
	var windowX =  (window.screen.width - wid) / 2 ;
	var windowY =  (window.screen.height - hei) / 2 ;
	params += ",top=" + windowY + ",left=" + windowX;
	var newWin = window.open(url,title,params);
}
/**
 * Description: 打开确认窗口
 */
function openConfirmWin(url,title,wid,hei,msg) {
	if(msg) {
		if(confirm(msg)) {
			openWin(url,title,wid,hei);
		}
	}
}

/**
 * Description: the seven display type
 * 滚动图片模板
 *
 */
var loadData7 = function(data, param) {
var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	//var strHtml = "<marquee direction=\"left\" width=\"384\" height=\"88\" loop=\"-2\">";
	var strHtml = "<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">";
	strHtml += "<tr>";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i=0;i<list.length;i++) {
			var obj = list[i];
			if(obj) {
				if(obj.name) {
					var strImg = "<img src=\"" + param.basePath + obj.name + "\" width=\"110px\" height=\"85px\" border=\"0px\">";
					var strUrl = "";
					if(data.linkUrl) {
						strUrl = param.basePath + data.linkUrl + obj.id;
						strUrl = "<a href=\"" + strUrl + "\" target=\"" + param.target + "\">" + strImg + "</a>";
					} else {
						strUrl = strImg;
					}
					strHtml += "<td align=\"left\" valign=\"middle\">" + strUrl + "</td>";
				}
			}
			strHtml += "<td align=\"left\" width=\"5px\">&nbsp;</td>";
		}
	}
	strHtml += "</tr></table>";
	strDiv.innerHTML = strHtml;
};


/**
 * Description: the seven display type
 * 滚动文字模板
 *
 */
var loadData11 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}

	var strHtml = "<marquee direction=\"up\" loop=\"-1\" scrollamount=\"2\" onmouseover=\"this.stop();\" onmouseout=\"this.start();\">";
	strHtml += "<ul>";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i=0;i<list.length;i++) {
			var obj = list[i];
			strHtml += "<li>";
			if(obj) {
				if(obj.name) {
					var title = obj.name;
					if(title.length > param.len + 10) {
						title = title.substring(0,param.len) + "...";
					}
					var strUrl = "";
					if(data.linkUrl) {
						strUrl = param.basePath + data.linkUrl + obj.id;
						strUrl = "<a href=\"javascript:void(0)\" onclick=\"openwindow('"+strUrl+"','','1000','600')\" >" + title + "</a>";
					} else {
						strUrl = title;
					}
					strHtml += strUrl;
				}
			}
			strHtml += "</li>";
		}
		strHtml += "</ul></marquee>";
	}else{
		strHtml = "<img src=\""+param.basePath+"/jfoss2/desktop/userconfig/images/None02.gif\" width=\"85\" height=\"85\">";
	}
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the eighth display type
 * 上下班登记模板
 */
var loadData8 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}


	var list = data.list;
	if(list && list.length > 0) {
		if(list[0].name) {
			strDiv.innerHTML = "<span>【你已上班，上班时间为：" + list[0].name + "】</span>";
		}
	}
}

/**
 * Description: the first display type
 * 待办事务模板
 *
 */
var loadData9 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<ul>";
	var list = data.list;
	if(list && list.length > 0) {
		for(var i in list) {
			var obj = list[i];
			if(obj) {
				strHtml += "<li>";
				var title = "";
				if(obj.name) {
					title = obj.name;
					if(title.length > param.len) {
						title = title.substring(0,param.len) + "...";
					}
				}
				var strUrl = "";
				if(obj.type) {
					strUrl = param.basePath + "/" + obj.type + "?taskId=" + obj.id;
					strUrl = "<a href=\"javascript:void(0)\" title='"+obj.name+"' onclick=\"openwindow('"+strUrl+"','','1000','600')\" >" + title + "</a>";
				} else {
					strUrl = title;
				}
				strHtml += strUrl;
			}
		}
		strHtml += "</ul>";
	}else{
		strHtml = "<img src=\""+param.basePath+"/resources/images/None03.gif\" width=\"85\" height=\"85\">";
	}
	strDiv.innerHTML = strHtml;
};

/**
 * Description: the tenth display type
 * 统计信息模板
 *
 */
var loadData10 = function(data, param) {
	JfossAjaxInvoke.loadSystemMsgStat(param.id,param.uid,{callback:function(data) {callLoadStatMsg(data, param, param.basePath);}});
};

/**
 * Description: the callback function for load system message
 * 统计信息加载回调函数
 */
var callLoadStatMsg = function(data, param, basePath) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	var strHtml = "<ul>";
	var list = data;
	if(list && list.length > 0) {
		for(var i=0;i<list.length;i++) {
			var obj = list[i];
			strHtml += "<li>";
			if(obj) {
				var strUrl = "";
				if(obj.linkUrl && obj.count != "0") {
					strUrl = basePath + obj.linkUrl;
					strUrl = "<a href=\"javascript:void(0)\" onclick=\"openwindow('"+strUrl+"','','1000','600')\" >" + obj.title + " （" + obj.count + "条）</a>";
				} else {
					strUrl = "<a>" + obj.title + " （" + obj.count + "条）</a>";
				}
				strHtml += strUrl;
			}
			strHtml += "</li>";
		}
	}
	strHtml += "</ul>";
	strDiv.innerHTML = strHtml;
};


/**
 * Description: the twelfth display type
 * iframe模板
 */
var loadData12 = function(data, param) {
	var strDiv = param.cpdiv;
	if(!strDiv) {
		return;
	}
	strDiv.innerHTML = "<table align='center' width='92%'><tr><td><iframe width='100%' src=\"" + data.linkUrl + "\" align=\"center\" frameborder=\"0\"></iframe></td></tr></table>";
}
 
 
 var loadAllDesktop = function(paramObj){
    createDiv(paramObj.layout);
   var template =paramObj.layout;

   var templates =template.split(";");
	var skinCookie /*存取皮肤的cookie名*/ = "SkinName";				
	var containerLayout /*存取页面布局的cookie名*/ = "containerLayout";
	var allCookies /*获取cookies*/ =paramObj.currentLayout ;
	var currentLayout /*定义页面容器的布局*/ = null;
	if(allCookies.indexOf(containerLayout) == -1){	//cookie中没有保持页面布局;
		currentLayout = "0,1,&2,3,4,&5,6,&";	//设置默认布局;
	}
	ttttt=templates.length;
	if(ttttt == 2) {
		maxlen = BIGLEN;
	} else if(ttttt == 3){
		maxlen = MIDDLELEN;
	} else if(ttttt == 4){
		maxlen = SMALLLEN;
	} else {
		maxlen = SMALLLEN;
	}
	paramObj.maxlen = maxlen;
	if (allCookies.indexOf(skinCookie) != -1 || allCookies.indexOf(containerLayout) != -1) {	//如果cookie中有保存皮肤或者布局的话；
		var pCookies /*每一个cookie组成的数组*/ = allCookies.split(";");
		for (var i = 0; i < pCookies.length; i++) {
			if (lTrim(pCookies[i]).substring(0, skinCookie.length + 1) == (skinCookie + "=")) {
				$("selector_a").className = $("selector_a").className.replace("_on_","");		//去掉按钮中默认的a皮肤的选择状态；
				var currentStyleSheet = lTrim(pCookies[i]).substring(skinCookie.length + 1);
				$("css").href = currentStyleSheet;
				var currentOnId = currentStyleSheet.substring(currentStyleSheet.indexOf("css/") + 4, currentStyleSheet.indexOf(".css"));
				$("selector_" + currentOnId).className = $("selector_" + currentOnId).className.replace("selector_" + currentOnId, "selector_" + currentOnId + "_on_");
			}else if(lTrim(pCookies[i]).substring(0, containerLayout.length + 1) == (containerLayout+"=")){
				currentLayout = lTrim(pCookies[i]).substring(containerLayout.length+1);	//获取cookie中的页面布局；
				
			}
		}
	}
	currentLayout = currentLayout.split("&");	//按"&"拆分currentLayout为一个数组；
	var xmlStr = paramObj.xmlStr;
	if(xmlStr) {
		var xmlDoc /*加载容器内容的xml*/ = loadXMLStr(xmlStr);
		for(var j = 0; j < templates.length-1; j++) {				//定义布局;每一个j是一个竖栏，一共有三栏；
			if (currentLayout[j]) {					//如果该竖栏内有容器的话；
				var maxK /*竖栏内的子容器数目*/ = getTheNumberOfFlag(currentLayout[j], ",");	
				var pContainers /*每个子容器的id数字号*/ = currentLayout[j].split(",");
				for (var k = 0; k < maxK; k++) {
					createDocument(pContainers[k],j,xmlDoc,paramObj);//创建每一个子容器;
				}
				maxK = 0;	//一个竖栏结束后，子容器数归零；
			}else{
				var o = new createHoldDiv()			
				$("main_layout_"+j).appendChild(o);		//如果整个竖栏没有一个容器则添加一个占位的容器防止错位;
			}
		}
		if (navigator.userAgent.indexOf("Firefox") != -1) {			//Firefox下添加选择器的换肤函数；
			for (var j = 0; j < $("color_selector").childNodes.length; j++) {
				if ($("color_selector").childNodes[j].id != "show") {
					$("color_selector").childNodes[j].addEventListener("click", changeSkin,true);
				}
			}
		}else{								//IE下添加选择器的换肤函数；
			for (var j = 0; j < $("color_selector").childNodes.length; j++) {
				if ($("color_selector").childNodes[j].id != "show") {
					$("color_selector").childNodes[j].attachEvent("onclick", changeSkin);
				}
			}				
		}
	}
}

/*
*$: 根据id获取对象；
*@param objId：对象id；
*/
function $(objId){	
	if (document.getElementById(objId)) {
		return document.getElementById(objId);
	}else {
		return;
	}
}

/*
*changeVisible: 更换内容的显示和隐藏状态；
*@param obj：触发对象；
*/
function changeVisible(e){
	if(ISFLODUPING == 1 || ISDRAGING == 1){	//如果已经在切换过程中则退出该函数，不执行任何操作；
		return;
	}
	ISFLODUPING = 1;	//设置操作状态为进行中；
	var e /*对应事件*/=e?e:(window.event?window.event:null);	
	var obj /*事件对象*/ = e.srcElement || e.target;		
	var oClassName /*触发器的class名*/ = obj.className;
	var foldUpDivId /*要进行状态切换的元素的id*/ = obj.parentNode.parentNode.getElementsByTagName("div")[1].id;
	var pHeight; /*要进行状态切换的元素的即时高度*/
	if (oClassName.indexOf("icon_min") > 0) {	//如果当前为展开状态则进行折叠操作；
		if($("delay_ture").checked == true){	//有延时效果的折叠操作；
			pHeight = $(foldUpDivId).offsetHeight;
			subtractHeight(pHeight,foldUpDivId,0);			
		}else{														//无延时效果的折叠操作
			$(foldUpDivId).style.display = "none";
			ISFLODUPING = 0;	
		}
		obj.className = oClassName.replace("icon_min", "icon_arror");	//切换触发器的状态；
	}else if(oClassName.indexOf("icon_arror") > 0){		//如果当前为折叠状态则进行展开操作；
		if($("delay_ture").checked == true){	//有延时效果的展开操作；
			$(foldUpDivId).style.visibility = "hidden";
			$(foldUpDivId).style.height = "auto";
			$(foldUpDivId).style.display = "block";
			pHeight = $(foldUpDivId).offsetHeight;
			$(foldUpDivId).style.visibility = "visible";
			addHeight(0,pHeight,foldUpDivId);			
		}else{														//无延时效果的展开操作；
			$(foldUpDivId).style.display = "block";
			ISFLODUPING = 0;	
		}
		obj.className = oClassName.replace("icon_arror", "icon_min");	//切换触发器的状态；
	}
}


/*
*changeSkin: 更换皮肤函数；
*@param obj：所选择的皮肤按钮的对象；
*/
function changeSkin(e){
	var e /*对应事件*/=e?e:(window.event?window.event:null);	
	var obj /*事件对象*/ = e.srcElement || e.target;	
	var skinName /*所选皮肤的选择器id*/ = obj.id;
	var oClassName /*所选皮肤的名字*/ = obj.className;
	if(oClassName.indexOf("_on_") > 0){		//如果已经是当前皮肤则推出函数不执行操作；
		return false;
	}	
	var cssDocumentName = $("css").href;	//获取当前文档的css链接；
	var currentClass = cssDocumentName.substring(cssDocumentName.indexOf("css/")+4,cssDocumentName.indexOf(".css"));	//从完整css链接中取出相应的css文件名；
	$("selector_"+currentClass).className = $("selector_"+currentClass).className.replace("_on_","");
	skinName = skinName.substring(skinName.indexOf("_")+1);
	obj.className = oClassName.replace("selector_"+skinName,"selector_"+skinName+"_on_");	//设置选择器为当前的选中状态；
	$("css").href = cssDocumentName.replace("/"+currentClass+".css","/"+skinName+".css");	//更换相应的链接；
	//document.cookie = "SkinName="+cssDocumentName.replace("/"+currentClass+".css","/"+skinName+".css")+"; max-age="+(60*60*24*365)+"; version="+encodeURIComponent(document.lastModified);	
}


/*
*hiddenContainer: 关闭层的函数；
*@param obj：要关闭的层；
*/
function closeContainer(e){
	if(ISCLOSING == 1 || ISDRAGING == 1){		//判断是否已锁定，如已锁定则不进行关闭操作
		return false;
	}
	var e /*对应事件*/=e?e:(window.event?window.event:null);	
	var obj /*事件对象*/ = e.srcElement || e.target;					
	ISCLOSING = 1;			//锁定，防止关闭过程中的再次操作
	var disappearDiv /*要关闭的层*/ = obj.parentNode.parentNode;
	var disappearId /*要关闭的层的id*/ = obj.parentNode.parentNode.id;
	if ($("delay_ture").checked == true) {
		try{
			var absoultDiv /*已设为绝对定位的层*/ = new modifyAbsoulteDiv (disappearDiv);
			var tempDiv /*临时的占位层*/ = new createTempDiv(disappearDiv,0);
			disappearDiv.parentNode.insertBefore(tempDiv ,disappearDiv);
			var tempDivHeight = Number(tempDiv.style.height.replace("px",""));
			disappearContainer(100,disappearId,tempDivHeight);	
		}catch(e){		//如发生错误则取消延时效果直接关闭；
			replaceSpaceOrRemoveDiv(disappearId);
			saveLayout()	//保持页面布局
			ISCLOSING = 0;			
		}
	}else{
		replaceSpaceOrRemoveDiv(disappearId);
		saveLayout()	//保持页面布局
		ISCLOSING = 0;
	}
}

/*
*disappearContainer: 要关闭的层逐渐减谈，并最终消除(删除)；
*@param nShowNumber：要关闭的层上一次循环的透明度；
*@param objId：要关闭的层的ID；
*@param objOriginalHeight：要关闭的层的高度；
*/
function disappearContainer(nShowNumber,objId,objOriginalHeight){
	var disappearId /*要关闭的层的ID*/ = objId;
	var showNumber /*要关闭的层*/ = nShowNumber - 10;
	if(showNumber > 0){	//如果透明度不为0则逐渐减少其透明度使其为0
		$(disappearId).style.opacity = showNumber / 100;
		$(disappearId).style.filter = "alpha(opacity=" + showNumber + ")";
		setTimeout("disappearContainer("+showNumber+",'"+disappearId+"',"+objOriginalHeight+")",100);
	}else{	//如果透明度已经为0则删除已绝对定位的层并逐步减少占位层的高度
		$(disappearId).parentNode.removeChild($(disappearId));
		subtractHeight(objOriginalHeight,"tempContentDiv",1);	//调用subtractHeight函数，逐步减少占位层的高度；
	}
}

/*
*modifyAbsoulteDiv ：将原始的层设为绝对定位；
*@param formerObject: 原始的div
*@type Object
*@return: formerObject 已设为绝对定位的层；
*/
function modifyAbsoulteDiv(formerObject){
	var referenceO = new getXY(formerObject)
	formerObject.style.position = "absolute";
	formerObject.style.zIndex = 1000;
	formerObject.style.width = referenceO[2] -2 +"px";
	formerObject.style.height = referenceO[3] -2 +"px";
	formerObject.style.top = referenceO[0] +"px";
	formerObject.style.left = referenceO[1]-MAGINLENGTH +"px";
	return formerObject;
}


/*
*createTempDiv：在原层的位置创建一个临时层，作为原层消失后的参照物；
*@param formerObject: 原始的div；
*@param hasBorder: 创建的层是否有虚线边框,0:不带虚线边框；1：带虚线边框；
*@type Object
*@return: containerTempObject 所创建的临时层；
*/
function createTempDiv(formerObject,hasBorder){
	var objHeight /*获取原先层的高度*/ = formerObject.offsetHeight;		
	var containerTempObject /*在原位置上创建的新层*/ = document.createElement("div");	
	containerTempObject.id = "tempContentDiv";
	containerTempObject.style.position = "static";
	if(hasBorder == 1){		//生成带虚线边框的层；
		containerTempObject.style.height = objHeight -2 +"px";
		containerTempObject.className = "tempContainer";	
	}else{		//生成不带虚线边框占位层；
		containerTempObject.style.height = objHeight +"px";
		containerTempObject.className = "tempNoBorderContainer";
	}
	return containerTempObject;
}


/*
*createTempDiv：创建一个完全的占位层，防止整栏的层都关闭后出现的错位情况；
*@type Object
*@return: containerHoldObject 所创建的完全占位层；
*/
function createHoldDiv(){
	var containerHoldObject /*创建一个占位的层防止整栏错位*/ = document.createElement("div");
	containerHoldObject.className = "container";
	containerHoldObject.style.border = 0;
	return containerHoldObject;
}


/*
*函数名：subtractHeight:	递减容器高度
*@param nHeight:		容器即时高度；
*@param objId:			要减高度的容器的id；
*@param iscreateDiv:	减高度后是否创建替代容器，防止整栏关闭后的错位 1：创建、0：不创建；
*/
function subtractHeight(nHeight,objId,iscreateDiv){
	var nowHeight /*递减容器的即时宽度*/ = nHeight -FOLDSPEED;
	var subtractDivId /*递减容器的ID*/ = objId;
	$(subtractDivId).style.height = nowHeight +"px";
	if(nowHeight > FOLDSPEED){
		window.setTimeout("subtractHeight("+nowHeight+",'"+subtractDivId+"',"+iscreateDiv+")",10);
	}else{
		if(iscreateDiv != 1){
			$(subtractDivId).style.display = "none";
			ISFLODUPING = 0;
		}else{
			replaceSpaceOrRemoveDiv(subtractDivId);
			ISCLOSING = 0;	//关闭容器锁定结束
		}		
	}
}


/*
*函数名：addHeight:	递增容器高度
*@param nHeight:	容器即时高度；
*@param objId:	要增加高度的容器的id；
*@param maxHeight:	增加到的高度；
*/
function addHeight(nHeight,maxHeight,objId){
	var pHeight /*容器即时高度*/ = nHeight + FOLDSPEED;
	var foldUpDivId /*要增加高度的容器的id*/ = objId;
	$(foldUpDivId).style.height = pHeight +"px";
	if(pHeight < maxHeight-FOLDSPEED){
		window.setTimeout("addHeight("+pHeight+","+maxHeight+",'"+foldUpDivId+"')",10);
	}else if(pHeight < maxHeight){
		$(foldUpDivId).style.height = maxHeight + "px";
		ISFLODUPING = 0;
	}
}


/*
*函数名：replaceSpaceOrRemoveDiv:	彻底删除层或替换为一个空的占位层防止整栏错位(如果整栏只有最后一个层的话)；
*@param objId:	要进行操作的层的id；
*/
function replaceSpaceOrRemoveDiv(objId){
	$(objId).style.display = "none";
	var fatherObject /*要操作元素的父级元素*/ = $(objId).parentNode;
	var firstObject /*父级元素的第一个element子元素*/ = new getFirstElementChild(fatherObject);
	var lastObject /*父级元素的最后一个element子元素*/= new getLastElementChild(fatherObject);
	if(firstObject != lastObject){
		$(objId).parentNode.removeChild($(objId));			
	}else{
		var holdDiv /*空白的占位层*/ = new createHoldDiv();
		$(objId).parentNode.replaceChild(holdDiv, $(objId));		
	}
	saveLayout()	//保持页面布局;
}

/*
*函数名：getLastElementChild:	 获取父级元素的最后一个element子元素；
*@param obj:	父级元素；
*@type Object
*@return: 最后一个类型为element的子元素；
*/
function getLastElementChild(obj){
	var objChilds /*父元素的所有子元素*/ = obj.childNodes;
	for(var i=objChilds.length-1;i>=0;i--){
		if(objChilds[i].nodeType == 1){
			return objChilds[i];
			break;
		}
	}
	return null;
}

/*
*函数名：getFirstElementChild:	 获取父级元素的第一个element子元素；
*@param obj:	父级元素；
*@type Object
*@return: 第一个类型为element的子元素；
*/
function getFirstElementChild(obj){
	var objChilds /*父元素的所有子元素*/ = obj.childNodes;
	for(var i=0;i<objChilds.length;i++){
		if(objChilds[i].nodeType == 1){
			return objChilds[i];
			break;
		}
	}
	return null;	
}

/*
*函数名：startMove:	 开始移动；
*@param e:	事件；
*/
function startMove(e){
	if(ISDRAGING == 1 || ISFLODUPING ==1 ||ISCLOSING == 1){		//如果正在移动过程中则停止移动；
		return;
	}
	ISDRAGING == 1;
	var e /*对应事件*/=e?e:(window.event?window.event:null);		
	var obj /*事件对象*/ = e.srcElement || e.target;		//获得触发事件的对象；
	//判断事件源
	if(obj.nodeName.toLowerCase() == "a") {
		return;
	}
	obj = obj.parentNode.parentNode;					//获得要拖拽的层；
	var absoultDiv /*已设为绝对定位的层*/ = new modifyAbsoulteDiv (obj);
	var tempDiv /*临时的带边框的占位层*/ = new createTempDiv(obj,1);
	obj.parentNode.insertBefore(tempDiv ,obj);
	absoultDiv.style.opacity = 0.5;
	absoultDiv.style.filter = "alpha(opacity=50)";	//将要拖拽的层设为半透明；
	var diffX /*鼠标位置和层开头之间X轴的间距*/= e.clientX - absoultDiv.offsetLeft;
	var diffY /*鼠标位置和层开头之间Y轴的间距*/= e.clientY - absoultDiv.offsetTop;
	if(document.addEventListener){					//DOM模型下增加mousemove和mouseup的监听函数；
		document.addEventListener("mousemove",handleMove,true);
		document.addEventListener("mouseup",handleMouseUp,true);
	}else if(document.attachEvent){					//IE下增加mousemove和mouseup的监听函数；
		absoultDiv.setCapture();
		absoultDiv.attachEvent("onmousemove",handleMove);
		absoultDiv.attachEvent("onmouseup",handleMouseUp);
		absoultDiv.attachEvent("onlosecapture",handleMouseUp);
	}else{											//IE5以下版本的操作；
		var oldMoveHandler = document.onmousemove;
		var oldUpHandler = document.onmouseup;
		document.onmousemove = handleMove;
		document.onmouseup = handleMouseUp;
	}
	if(e.stopPropagation){
		e.stopPropagation();
	}else{
		e.cancelBubble = true;
	}
	if(e.preventDefault){
		e.preventDefault();
	}else{
		e.returnValue = false;
	}
	/*
	*handleMove：鼠标开始移动时的操作；
	*/
	function handleMove(e){	
	



		absoultDiv.style.top = e.clientY - diffY + "px";
		absoultDiv.style.left = e.clientX - diffX + "px";		//层跟这鼠标走--实现拖拽；
		var pointDirection;	//目标层的指向;
		var formarFather = absoultDiv;
		for(var i=0;i<20;i++){
			if ($("container" + i) == null) { //已经关闭的层不再遍历;
				continue;
			}
			if($("container"+i)==absoultDiv){	//是本身不遍历；	
				continue;
			}
			pointDirection = innerPosition($("container"+i),e);		//获取目标层指向
			if(pointDirection == 0){	//如果不在这个层的范围内则继续下一次循环
				continue;
			}else{			//在这个层的上下范围内，进行目标层切换；
				replaceTempDiv($("container"+i),$("tempContentDiv"),pointDirection);
				return;	
			}
		}
		
		for(var j=0;j<ttttt-1;j++){	//如果没有一个层在内的话则检查所有竖栏；
	
			if(hasContainerChild($("main_layout_"+j),"container")>0){	//如果该栏目有子容器则跳过进行下一次循环；
				continue;
			}
			var o = getXY($("main_layout_"+j));
			if(e.clientX > o[1] && e.clientX<(o[1]+o[2])){	//如果鼠标在该竖栏的范围内则直接切换目标层；
				for(var k=0;k<$("main_layout_"+j).childNodes.length;k++){	//此时切换需首先删除该竖栏下所有添加的占位层；
					if($("main_layout_"+j).childNodes[k]!=$("tempContentDiv")){
						$("main_layout_"+j).removeChild($("main_layout_"+j).childNodes[k]);
					}
				}
				$("main_layout_"+j).appendChild($("tempContentDiv"));	
			}
		}
		if(e.stopPropagation){
			e.stopPropagation();
		}else{
			e.cancelBubble = true;
		}
	}
	
	/*
	*handleMove：鼠标放开后的操作；
	*/	
	function handleMouseUp(e){
		if(document.removeEventListener){			//DOM模型下删除mousemove和mouseup的监听函数；
			document.removeEventListener("mouseup",handleMouseUp,true);
			document.removeEventListener("mousemove",handleMove,true);
		}else if(document.detachEvent){				//IE模型下删除mousemove和mouseup的监听函数；
			absoultDiv.detachEvent("onlosecapture",handleMouseUp);
			absoultDiv.detachEvent("onmouseup",handleMouseUp)
			absoultDiv.detachEvent("onmousemove",handleMove);
			absoultDiv.releaseCapture();
		}else{										//IE5以下版本下删除mousemove和mouseup的监听函数；
			document.onmouseup = oldUpHandler;
			document.onmousemove = oldMoveHandler;
		}
		var newDiv = absoultDiv;	//复制拖拽层;
		newDiv.style.position = ""; 
		newDiv.style.opacity = 1;
		newDiv.style.filter = "alpha(opacity=100)";
		newDiv.style.height = "";			//以上四行还原层的原始属性；
		absoultDiv.parentNode.removeChild(absoultDiv);		//删除原来的拖拽层；
		$("tempContentDiv").parentNode.insertBefore(newDiv,$("tempContentDiv"));	//将拖拽的层插入到指定位置；
		$("tempContentDiv").parentNode.removeChild($("tempContentDiv"));		//删除原来的临时占位层；
		if(e.stopPropagation){
			e.stopPropagation();
		}else{
			e.cancelBubble = true;
		}
		saveLayout()			//保存页面布局;
		ISDRAGING == 0;			//解除拖拽的锁定；
	}	
}

/*
*函数名：replaceTempDiv:	 替换目标层函数；
*@param positionDiv:	要替换到的目标层；
*@param formarTempDiv:	原来的占位层；
*@param isFront:	目标层的上、下方；
*@type array; 
*@return: a[0]:顶部位置、a[1]:左边位置、a[2]:宽度、a[3]:高度；
*/
function replaceTempDiv(positionDiv,formarTempDiv,isFront){
	var newDiv /*复制原来的占位层*/ = formarTempDiv;
	if(hasContainerChild(formarTempDiv.parentNode,"container")== 1){	//判断移开后竖栏还有没有其他的container容器，如果没有则添加一个占位层；
		var o = createHoldDiv();
		formarTempDiv.parentNode.appendChild(o);
	}
	formarTempDiv.parentNode.removeChild(formarTempDiv);
	if(positionDiv == getLastElementChild(positionDiv.parentNode) && isFront == 2){	//如果整个竖栏没有其他container元素；
		positionDiv.parentNode.appendChild(newDiv);
	}else if(isFront == 2){
		positionDiv.parentNode.insertBefore(newDiv,positionDiv.nextSibling);		//如果在目标元素下面；
	}else{																			//如果在目标元素上面；
		positionDiv.parentNode.insertBefore(newDiv,positionDiv);	
	}
	
}

/*
*函数名：getXY:	 获取元素在屏幕内的绝对位置及高度和宽度；
*@param obj:	要检测的元素；
*@type array; 
*@return: a[0]:顶部位置、a[1]:左边位置、a[2]:宽度、a[3]:高度；
*/
function getXY(obj){
	var a /*返回对象*/ = new Array();
	var t = obj.offsetTop;
	var l = obj.offsetLeft;
	var w = obj.offsetWidth;
	var h = obj.offsetHeight;
	while(obj=obj.offsetParent){
		t+=obj.offsetTop;
		l+=obj.offsetLeft;
	}
	a[0] = t;
	a[1] = l;
	a[2] = w;
	a[3] = h;
	return a;
}

/*
*函数名：innerPosition:	 获得拖拽目标层的指向；
*@param obj:	正在检查的元素；
*@param e:	鼠标事件；
*@type number; 
*@return: 0：不在这个层的指向范围内；1：在这个层上方；2：在这个层下方；
*/
function innerPosition(obj,e){
	var e /*鼠标事件*/=e?e:(window.event?window.event:null);
	var a /*拖拽元素的位置集合*/ = getXY(obj);
	if (e.clientX>a[1] && e.clientX<=(a[1]+a[2]) && e.clientY>a[0] && e.clientY <=(a[0]+a[3])){	//如果鼠标在元素范围内；
		if(e.clientY<(a[0]+a[3]/2)){
			return 1;	//向上;
		}else{
			return 2;	//向下;
		}
	}else{	//如果鼠标在元素范围外同时该竖栏只有一个元素；
		var aLastSibling /*所检测元素父元素的最后一个子元素*/ = new getLastElementChild(obj.parentNode);
		var aLastPosition /*检查最后一个元素的位置*/= getXY(aLastSibling);
		if ( aLastSibling==obj && e.clientX > a[1] && e.clientX<=(a[1]+a[2]) && e.clientY > (aLastPosition[0] + aLastPosition[3])) {	
			return 2;	//竖栏最后一个元素向下;
		}else{
			return 0;
		}
	}
}

/*
*函数名：hasContainerChild:	 检查容器内是否含有id为content开头的子元素；
*@param obj:	要检查的容器；
*@param content:	要匹配的内容；
*@type number; 
*@return: childNum：子容器个数；
*/
function hasContainerChild(obj,content){
	var childNum /*是否有自容器*/= 0;
	for(var i=0;i<obj.childNodes.length;i++){
		if((obj.childNodes[i].id) && obj.childNodes[i].id.indexOf(content)>-1){
			childNum += 1;
		}
	}
	return childNum;
}

/*
*函数名：lTrim:	去掉字符串左边的空格；
*@param str:	要检查的字符串；
*@type string;
*@return: str： 去掉左边空格后的字符串；
*/
function lTrim(str){ 
	if(str.charAt(0) == " "){ //如果字串左边第一个字符为空格 
		str = str.slice(1);//将空格从字串中去掉 
		str = lTrim(str); //递归调用 
	} 
	return str; 
} 


/*
*函数名：getTheNumberOfFlag:	获取字符串中特殊字符的个数；
*@param str:	要检查的字符串；
*@param flag:	要计算的特殊字符；
*@type number;
*@return: iNum： 特殊字符出现的个数；
*/
function getTheNumberOfFlag(str,flag){
	var iNum /*特殊字符出现的个数，默认为0*/= 0;
	for(var i=0;i<str.length;i++){
		if(str.charAt(i) == flag){
			iNum += 1;
		}
	}
	return iNum;
}

/*
*函数名：saveLayout:	保存页面布局；
*/
function saveLayout(){
	$("promptSave").style.display = "block";
	
}
function saveLastLayout() {
	var containerArray = "";
	var containerName = "container";
	var ids = "";
	for(var i=0;i<ttttt-1;i++){
		for(var j=0;j<$("main_layout_"+i).childNodes.length;j++){
			if($("main_layout_"+i).childNodes[j].id && $("main_layout_"+i).childNodes[j].id.indexOf("container")>-1){
				var oNum = $("main_layout_"+i).childNodes[j].id;
				oNum = oNum.substring(containerName.length,oNum.length);
				containerArray += oNum+",";
				ids += oNum + ",";
			}
		}
		containerArray += "&";
	}
	//document.cookie = "containerLayout="+containerArray+"; max-age="+(60*60*24*365)+"; version="+encodeURIComponent(document.lastModified);
	JfossAjaxInvoke.saveUserConfigLayOut(containerArray,ids,displayButton);
	ids = "";
	containerArray = "";
}

/*
*函数名：createDocument:	创建container元素；
*@param ci:	所属的竖栏；
*@param cj:	对应的container编号；
*/
function createDocument(ci,cj,xmlDocument,paramObj){
	//if (navigator.userAgent.indexOf("Firefox") != -1) {	//Firefox下的操作;
	if(window.addEventListener) {	
		var c = document.createElement("div");
		c.setAttribute("class", "container");
		c.setAttribute("id", "container" + ci);
		var ct = document.createElement("div");
		ct.setAttribute("class", "container_title");
		var ca1 = document.createElement("a");
		
		ca1.setAttribute("class", "minbox icon_x");
		ca1.addEventListener("click", closeContainer,true);
		var ca2 = document.createElement("a");
		
		ca2.setAttribute("class", "minbox icon_min");
		ca2.addEventListener("click", changeVisible,true);
		
		var ca3 = document.createElement("a");
		ca3.setAttribute("className", "minbox_more");
		
		var ch3 = document.createElement("h3");
		ch3.addEventListener("mousedown", startMove,true);
		var ch3a = document.createElement("a");
	
		var cp = document.createElement("div");
		cp.setAttribute("class","container_content");
	}else{									//针对IE的操作；
		var c = document.createElement("div");
		c.setAttribute("className", "container");
		c.setAttribute("id", "container" + ci);
		var ct = document.createElement("div");
		ct.setAttribute("className", "container_title");
		var ca1 = document.createElement("a");
		
		ca1.setAttribute("className", "minbox icon_x");
		ca1.attachEvent("onclick", closeContainer);
		var ca2 = document.createElement("a");
		
		ca2.setAttribute("className", "minbox icon_min");
		ca2.attachEvent("onclick", changeVisible);
		
		var ca3 = document.createElement("a");
		ca3.setAttribute("className", "minbox_more");
		
		var ch3 = document.createElement("h3");
		ch3.attachEvent("onmousedown", startMove);
		var ch3a = document.createElement("a");
		
		var cp = document.createElement("div");
		cp.setAttribute("className","container_content");
	}
	cp.setAttribute("id","p"+ci);
	ch3.appendChild(ch3a);
	ct.appendChild(ca1);
	ct.appendChild(ca2);
	ct.appendChild(ca3)
	ct.appendChild(ch3);
	c.appendChild(ct);
	c.appendChild(cp);
	$("main_layout_"+cj).appendChild(c);
	var v_title = xmlDocument.getElementsByTagName("title"+ci)[0];
	var v_target = xmlDocument.getElementsByTagName("target"+ci)[0];
	var target = "_self";
	if(v_target && v_target.firstChild) {
		target = v_target.firstChild.nodeValue;
	}
	if(!target) {
		target = "_self";
	}
	if(v_title) {
		ch3a.innerHTML = v_title.firstChild.nodeValue;
		/*
		var v_titleUrl = xmlDocument.getElementsByTagName("titleurl"+ci)[0];
		if(v_titleUrl && v_titleUrl.firstChild) {
			var url_val = v_titleUrl.firstChild.nodeValue;
			if(url_val) {
				if(url_val.indexOf("http://")==0) {
					ch3a.setAttribute("href", v_titleUrl.firstChild.nodeValue);
					ca3.setAttribute("href", v_titleUrl.firstChild.nodeValue);
					ch3a.setAttribute("target", target);
					ca3.setAttribute("target", target);
				} else {
					ch3a.setAttribute("href", paramObj.basePath + v_titleUrl.firstChild.nodeValue);
					ca3.setAttribute("href", paramObj.basePath + v_titleUrl.firstChild.nodeValue);
					ch3a.setAttribute("target", target);
					ca3.setAttribute("target", target);
				}
			}
		}
		*/
	}
	var v_id = xmlDocument.getElementsByTagName("id"+ci)[0];
	if(v_id) {
		var deskId = v_id.firstChild.nodeValue;	
		loadDesktop({id:deskId,len:paramObj.maxlen, basePath: paramObj.basePath, uid:paramObj.uid, uname:paramObj.uname,  deptname:paramObj.deptname, cpdiv:cp, target: target});
	}
}


/*
*函数名：loadXML:	加载XML文件；
@param xmlUrl:要加载的xml文件路径；
*/
function loadXML(xmlUrl){
	var xmlDoc;
	if(window.ActiveXObject){
		xmlDoc = new ActiveXObject('Msxml2.DOMDocument');
		xmlDoc.async = false;
		xmlDoc.loadXML(xmlUrl);		
	}else if(document.implementation&&document.implementation.createDocument){
		xmlDoc = document.implementation.createDocument('', '', null);
		xmlDoc.async = false;
		xmlDoc.loadXML(xmlUrl);		
	}else{
		return null;
	}
	return xmlDoc;
}
/**
 * 函数名：xmlDocToStr:返回xml文档对象的字符串形式
 * @param xmlDoc:xml文档对象
 */
function xmlDocToStr(xmlDoc) {
	if(xmlDoc) {
		if(xmlDoc.xml) {
		 	return xmlDoc.xml;	
		} else {
			var oSerializer=new XMLSerializer();
			var sXml=oSerializer.serializeToString(xmlDoc,"text/xml");	
			return sXml;
		}
	} else {
	  return null;	
	}
}
/*
 * 函数名：loadXML:	加载XML字符串；
 * @param xmlStr:要加载的xml字符串
 */
function loadXMLStr(xmlStr) {
	var xmlDoc;
	if(window.ActiveXObject){
		xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
		xmlDoc.loadXML(xmlStr);		
	}else if(window.DOMParser){
		xmlDoc = new DOMParser().parseFromString(xmlStr, "text/xml"); 
	}else{
		return null;
	}
	return xmlDoc;	
}

function createDiv(temp){
   
   if(temp){
    var templates=temp.split(";");
    var main=document.getElementById("main");
    
    for(var i=0;i<templates.length;i++){
       var c1 = document.createElement("div");
       c1.className="main_layout";
       c1.id="main_layout_"+i;
       var layOutStyle=c1.style;
       layOutStyle.width=templates[i];
      
       main.appendChild(c1);
    		} 
    	}

}

/**
 * 取消按钮
 * @return
 */
function displayButton(){
	window.location.replace("${ctx}/userConfig!modifyInfo.action");
}

/**
 * 被调用页面刷新
 * @return
 */
function reloadHTML(){
	window.location.replace("${ctx}/userConfig!modifyInfo.action");
}